import Vue from "vue";
import Message from "./index.vue";

Message.instance = (properties) => {
  const props = properties || {};
  const Instance = new Vue({
    data: props,
    render(h) {
      return h(Message, {
        props,
      });
    },
  });
  const components = Instance.$mount();
  document.body.appendChild(components.$el);

  const message = Instance.$children[0];

  return {
    add(props) {
      message.add(props);
    },
    remove(name) {
      message.remove(name);
    },
  };
};

export default Message;
